package com.pansoft.kline.adapter;

import androidx.annotation.Nullable;

import com.chad.library.adapter.base.BaseQuickAdapter;
import com.chad.library.adapter.base.BaseViewHolder;
import com.efounder.utils.JfResourceUtil;
import com.pansoft.kline.model.KlineOptionalOrMVModel;
import com.pansoft.openplanet.R;

import java.util.List;

/**
 * @author : zzj
 * @e-mail : zhangzhijun@pansoft.com
 * @date : 2018/11/19 19:13
 * @desc : 涨跌幅的头部列表的适配器
 * @version: 1.0
 */
public class KLineRiseFallHeaderAdapter extends BaseQuickAdapter<KlineOptionalOrMVModel,BaseViewHolder> {


    public KLineRiseFallHeaderAdapter(int layoutResId, @Nullable List<KlineOptionalOrMVModel> data) {
        super(layoutResId, data);
    }

    @Override
    protected void convert(BaseViewHolder helper, KlineOptionalOrMVModel item) {

        helper.setText(R.id.tv_title,item.getName());
        helper.setText(R.id.tv_price,item.getPrice());
        helper.setText(R.id.tv_change_rate,item.getChangeRate());

        if(item.isIncrease()){
            helper.setTextColor(R.id.tv_price, JfResourceUtil.getSkinColor(R.color.increasing_color));
            helper.setTextColor(R.id.tv_change_rate,JfResourceUtil.getSkinColor(R.color.increasing_color));
        }else {
            helper.setTextColor(R.id.tv_price,JfResourceUtil.getSkinColor(R.color.decreasing_color));
            helper.setTextColor(R.id.tv_change_rate,JfResourceUtil.getSkinColor(R.color.decreasing_color));
        }

    }
}
